package com.tbit.uqbike.service.business.tag;

import java.util.Collections;
import java.util.Map;
import java.util.Set;

/**
 * 设备信息校验结果
 *
 *
 * @author <a href="mailto:chen.chaoxiong@tbit.com.cn">ChenChaoXiong</a>
 * @since 2024/7/11
 */
public class MachineInfoValidationResult<T> {
    private boolean valid;

    /**
     *  key: machineId value: machineinfo: machineNo/userCode等
     */
    private Map<Integer,T> machineinfoMap;

    public MachineInfoValidationResult(boolean valid, Map<Integer,T> machineinfoMap) {
        this.valid = valid;
        this.machineinfoMap = machineinfoMap;
    }

    public boolean isValid() {
        return valid;
    }

    public Map<Integer,T> getMachineinfoMap() {
        return machineinfoMap;
    }

    public static MachineInfoValidationResult<String> invalid() {
        return new MachineInfoValidationResult<>(false, Collections.emptyMap());
    }

    public static <T> MachineInfoValidationResult<T> valid(Map<Integer,T> machineinfoMap) {
        return new MachineInfoValidationResult<>(true, machineinfoMap);
    }
}
